package com.shuqi.common;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import android.content.Context;
import android.text.TextUtils;

import com.shuqi.common.utils.Log4an;
import com.shuqi.controller.MyFavoritController.ActionEnum;
import com.shuqi.model.net.UrlManager;
import com.shuqi.model.sharedprefs.StaticDomains;
import com.shuqi.model.sharedprefs.WebUrls;

/**
 * 所有接口的 URL拼接添加参数，返回完整的：接口地址/网页url
 * 
 * @author vip
 */
public class Urls {

    // 1.---------------网页Url地址-------------------------------------------------------------------------------------

    /** 1. 访问一搜网页主页地址 */
    public static String getWebYisouHomeUrl(Context context) {
        String key = WebUrls.getInstence().getWebUrlsKey(context, WebUrls.TYPE_ID_WEBURL_YISOUHOME);
        if (TextUtils.isEmpty(key)) {
            key = "book.sm.cn";
        }
        if (UrlManager.isWebYisouDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_SHENMA;
        }
        return "http://" + key;
    }

    /**
     * 2. 访问web封面页
     * 
     * @param bid
     * @param sourceid 来源
     * @param context
     */
    public static String getWebBookCoverUrl(String bid, String sourceid, Context context) {
        String key = WebUrls.getInstence().getWebUrlsKey(context, WebUrls.TYPE_ID_WEBURL_BOOCOVER);
        if (TextUtils.isEmpty(key)) {
            key = "bookt.sm.cn/i.php?ct=def&ac=show";
        }
        if (UrlManager.isWebYisouDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_SHENMA + "/i.php?ct=def&ac=show";// 　测试域名
        }
        return "http://" + key + "&appaction=1&bid=" + bid + "&sourceid=" + sourceid;
    }

    /**
     * 3. 访问正常web一搜搜索结果页
     * 
     * @param context
     * @param keyword 关键词
     * @return
     */
    public static String getWebSearchResult(Context context, String keyword) {

        String key =
                WebUrls.getInstence().getWebUrlsKey(context, WebUrls.TYPE_ID_WEBURL_SEARCHRESULT);
        if (TextUtils.isEmpty(key)) {
            key = "bookt.sm.cn/i.php?ct=sch&ac=in";
        }
        if (UrlManager.isWebYisouDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_SHENMA + "/i.php?ct=sch&ac=in";
        }
        return "http://" + key + "&keyword=" + keyword;
    }

    /**
     * 4. 访问web阅读页页
     * 
     * @param bookId
     * @param src 来源id
     * @param cid 章节id
     */
    public static String getWebBookReadUrl(Context context, String bookId, String src, String cid) {
        String key = WebUrls.getInstence().getWebUrlsKey(context, WebUrls.TYPE_ID_WEBURL_BOOKREAD);
        if (TextUtils.isEmpty(key)) {
            key = "bookt.sm.cn/i.php?ct=book&ac=in";
        }
        if (UrlManager.isWebYisouDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_SHENMA + "/i.php?ct=book&ac=in";
        }
        return "http://" + key + "&bid=" + bookId + "&sourceid=" + src + "&chapterid=" + cid
                + "&type=1";
    }

    /** 5. 书旗尝鲜版下载页 */
    public static String getWebDownLoadBetaAppUrl(Context context) {
        String key =
                WebUrls.getInstence()
                        .getWebUrlsKey(context, WebUrls.TYPE_ID_WEBURL_DOWNLOADBETAAPP);
        if (TextUtils.isEmpty(key)) {
            key = "t.shuqiread.com/i.php?ct=noti&ac=sma";
        }
        return "http://" + key + "appfunction=an_upd,1";
    }



    /** 6. 书旗网主页地址 */
    public static String getWebShuQiHomeUrl(Context context) {
        String key = WebUrls.getInstence().getWebUrlsKey(context, WebUrls.TYPE_ID_WEBURL_SHUQIHOME);
        if (TextUtils.isEmpty(key)) {
            key = "t.shuqi.com";
        }
        return "http://" + key;
    }

    /**
     * 8. 制作书单的固定wap页面的url
     */
    public static String getWebCreteBookListUrl(Context context) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context, WebUrls.TYPE_ID_WEBURL_CREATEBOOKLIST);
        if (TextUtils.isEmpty(key)) {
            key = "t.shuqiread.com/i.php?ct=oder&ac=crea";
        }
        return "http://" + key;
    }

    /**
     * 9. 搜索结果页内嵌搜索结果页Url：JS交互专用url
     * 
     * @param context
     * @param keyword 关键词
     * @return
     */
    public static String getWebSearchResultForAppJS(Context context, String keyword) {
        try {
            keyword = URLEncoder.encode(keyword, "UTF-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        String key =
                WebUrls.getInstence().getWebUrlsKey(context,
                        WebUrls.TYPE_ID_WEBURL_SEARCHRESULTFORAPPJS);
        if (TextUtils.isEmpty(key)) {
            key = "bookt.sm.cn/i.php?ct=sch&ac=app";
        }
        if (UrlManager.isWebYisouDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_SHENMA + "/i.php?ct=sch&ac=app";
        }
        return "http://" + key + "&keyword=" + keyword;
    }

    /***
     * 10. 用户注册协议网址
     * 
     * @param context
     * @return
     */
    public static String getWebRegisterProtocolUrl(Context context) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context,
                        WebUrls.TYPE_ID_WEBURL_REGISTERPROTOCOL);
        if (TextUtils.isEmpty(key)) {
            key = "t.shuqi.com/i.php?ct=def&ac=bank";
        }
        return "http://" + key;
    }

    /***
     * 11. 网页一搜书籍目录地址
     * 
     * @param context
     * @return
     */
    public static String getWebBookCatalogUrl(Context context, String bookId, String sourceId) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context, WebUrls.TYPE_ID_WEBURL_BOOKCATALOG);
        if (TextUtils.isEmpty(key)) {
            key = "bookt.sm.cn/i.php?ct=book&ac=list";
        }
        if (UrlManager.isWebYisouDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_SHENMA + "/i.php?ct=book&ac=list";
        }
        return "http://" + key + "&bid=" + bookId + "&sourceid=" + sourceId;
    }


    // -----------------------网页版书城----------------------

    /** 12. 网页版本书城主页：推荐地址 */
    public static String getWebShuqiRecommendUrl(Context context) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context,
                        WebUrls.TYPE_ID_WEBURL_BOOKSTORE_RECOMMEND);
        if (TextUtils.isEmpty(key)) {
            key = UrlManager.DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/def/";
        }
        if (UrlManager.isWebShuqiDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/def/";
        }
        return "http://" + key;
    }

    /** 13. 网页版本书城主页：排行地址 */
    public static String getWebShuqiRankUrl(Context context) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context, WebUrls.TYPE_ID_WEBURL_BOOKSTORE_RANK);
        if (TextUtils.isEmpty(key)) {
            key = UrlManager.DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/ranks/";
        }
        if (UrlManager.isWebShuqiDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/ranks/";
        }
        return "http://" + key;
    }

    /** 14. 网页版本书城主页：分类地址 */
    public static String getWebShuqiCategoryUrl(Context context) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context,
                        WebUrls.TYPE_ID_WEBURL_BOOKSTORE_CATEGORY);
        if (TextUtils.isEmpty(key)) {
            key = UrlManager.DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/classList/";
        }
        if (UrlManager.isWebShuqiDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/classList/";
        }
        return "http://" + key;
    }


    /** 15. 网页版本书城主页：作者书记列表地址 */
    public static String getWebShuqiAuthorBooksUrl(Context context, String authorId) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context,
                        WebUrls.TYPE_ID_WEBURL_BOOKSTORE_AUTHORBOOKS);
        if (TextUtils.isEmpty(key)) {
            key = UrlManager.DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/authorWorks/";
        }
        if (UrlManager.isWebShuqiDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/authorWorks/";
        }
        return "http://" + key + "aid/" + authorId + "/";
    }

    /** 16. 网页版本书城主页：标签书记列表地址 */
    public static String getWebShuqiTagBooksUrl(Context context, String tagName) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context,
                        WebUrls.TYPE_ID_WEBURL_BOOKSTORE_TAGBOOKS);
        if (TextUtils.isEmpty(key)) {
            key = UrlManager.DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/tagList/";
        }
        if (UrlManager.isWebShuqiDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/tagList/";
        }
        try {
            tagName = URLEncoder.encode(tagName, "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();
        }

        return "http://" + key + "keyword/" + tagName + "/";
    }

    /** 17. 网页版本书城主页：分类书记列表地址 */
    public static String getWebShuqiCategoryBooksUrl(Context context, String catalogId) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context,
                        WebUrls.TYPE_ID_WEBURL_BOOKSTORE_CATEGORYBOOKS);
        if (TextUtils.isEmpty(key)) {
            key = UrlManager.DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/classTable/";
        }
        if (UrlManager.isWebShuqiDemoDomain(context)) {
            key = UrlManager.DEMO_DOMAIN_WEB_BOOKSTORE + "/#!/ac/in/ct/classTable/";
        }
        return "http://" + key + "cid/" + catalogId + "/";
    }

    /** 18. 网页版本书城主页：书旗网触屏版封面地址 */
    public static String getWebShuqiBookCoverUrl(Context context, String bookId) {
        String key =
                WebUrls.getInstence().getWebUrlsKey(context,
                        WebUrls.TYPE_ID_WEBURL_BOOKSTORE_SHUQI_BOOKCOVER);
        if (TextUtils.isEmpty(key)) {
            key = "t2.shuqi.com/i.php?ct=def&ac=show";
        }
        return "http://" + key + "&bid=" + bookId;
    }



    // 2.---------------正常接口地址-------------------------------------------------------------------------------------


    /**
     * 排行【读域名】
     */
    public static String getRankListUrl() {
        return "/app/bc_app_rank.php?" + ConfigVersion.getVersion();
    }

    /**
     * 分类【读域名】
     * 
     * @return
     */
    public static String getSortUrl() {
        return "/app/bc_app_category.php?" + ConfigVersion.getVersion();
    }

    /**
     * 限免【读域名】
     * 
     * @return
     */
    public static String getFreeUrl(int pageIndex) {
        return "/app/bc_app_column.php?columnId=10231" + "&pageIndex=" + pageIndex + "&"
                + ConfigVersion.getVersion();
    }

    /**
     * 
     * 查看更多数据,推荐详情【读域名】
     * 
     * @return
     */
    public static String getMoreRecommendUrl(String columnId, int pageIndex) {
        return "/app/bc_app_column.php?columnId=" + columnId + "&pageIndex=" + pageIndex + "&"
                + ConfigVersion.getVersion();
    }


    /***
     * 获取封面信息接口 【读域名】
     * 
     * @param bookId
     * @param userId
     * @return
     */
    public static String getBookCoverUrl(String bookId, String userId) {
        return "/app/bc_app_book_cover.php?bookId=" + bookId + "&user_id=" + userId + "&"
                + ConfigVersion.getVersion();
    }

    /**
     * 搜索主页【搜索域名】
     */
    public static String getSearchUrl(String type, String rankId) {
        StringBuilder url = new StringBuilder();
        if (type.equals("hot")) {
            url.append("/ppso_hot_search_recommend.php?");
        } else if (type.equals("rank")) {
            url.append("/ppso_ranking.php?rankId=").append(rankId);
        }
        url.append("&" + ConfigVersion.getVersion());
        return url.toString();
    }

    /**
     * 购买全本、章节【写域名】
     * 
     * @param uid
     * @param bookid
     * @param act full购买全本 不传cids；
     * @param cids cid1_cid2_cid3_cid4_cid5，最少1章节,最多5章节 不传act；
     * @param isBuy 如果有收费的则购买,按章收费;默认false
     * @return
     */
    public static String getBuyBookUrl(String uid, String bookid, String act, String cids,
            boolean isBuy, String price) {
        StringBuilder buffer = new StringBuilder();
        buffer.append("/app/bc_app_buy_chapter.php?");
        buffer.append("user_id=" + uid);
        buffer.append("&bookId=" + bookid);
        if (act == null) {
            buffer.append("&chapters=" + cids);
        } else {
            buffer.append("&act=" + act);
        }
        buffer.append("&buy=" + isBuy);
        buffer.append("&price=" + price);
        buffer.append("&" + ConfigVersion.getVersion());
        return buffer.toString();
    }

    /**
     * 收费书籍目录接口【读域名】
     * 
     * @return
     */
    public static String getPayCatalogUrl(String uid, String bookId) {
        StringBuilder buffer = new StringBuilder();
        buffer.append("/app/bc_app_chapter_list.php?");
        buffer.append("user_id=" + uid);
        buffer.append("&bookId=" + bookId);
        buffer.append("&" + ConfigVersion.getVersion());
        return buffer.toString();
    }

    /**
     * 一搜目录接口【搜索域名】
     * 
     * @return
     */
    public static String getYiSouCatalogUrl(String uid, String sourceId, String bookId) {
        StringBuilder buffer = new StringBuilder();
        buffer.append("/ppso_chapter.php?");
        buffer.append("user_id=" + uid);
        buffer.append("&bookId=" + bookId);
        buffer.append("&sourceId=" + sourceId);
        buffer.append("&" + ConfigVersion.getVersion());
        return buffer.toString();
    }

    /**
     * 书旗获取单条目录的URL【读域名】
     */
    public static String getShuqiOneCatalogUrl(String uid, String bookId, String chapterId) {
        StringBuilder buffer = new StringBuilder();
        buffer.append("/app/bc_app_chapter_list.php?");
        buffer.append("user_id=" + uid);
        buffer.append("&bookId=" + bookId);
        buffer.append("&chapterId=" + chapterId);
        buffer.append("&" + ConfigVersion.getVersion());
        return buffer.toString();
    }

    /**
     * 一搜获取单条目录的URL【搜索域名】
     */
    public static String getYiSouOneCatalogUrl(String uid, String bookId, String sourceId,
            String chapterId, int pageSize) {
        StringBuilder buffer = new StringBuilder();
        buffer.append("/ppso_chapter.php?");
        buffer.append("user_id=" + uid);
        buffer.append("&pagesize=" + pageSize);
        buffer.append("&bookId=" + bookId);
        buffer.append("&sourceId=" + sourceId);
        buffer.append("&chapterId=" + chapterId);
        buffer.append("&" + ConfigVersion.getVersion());
        return buffer.toString();
    }

    /**
     * 搜索联想【搜索域名】
     */
    public static String getSearchAssociateURL(String key) {
        String url = "";
        try {
            url = "/ppso_capacityword.php?key=" + URLEncoder.encode(key, "utf-8");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        url = url + "&" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 推荐【读域名】
     */
    public static String getRecommendUrl() {
        return "/app/bc_app_column.php?" + ConfigVersion.getVersion();
    }

    /**
     * 专题详情【读域名】
     */
    public static String getProjectDetailsUrl(String topicId) {

        return "/app/bc_app_topic.php?topicId=" + topicId + "&" + ConfigVersion.getVersion();
    }

    /**
     * 排行详情【读域名】
     */
    public static String getRanklistDetailsUrl(String rankId, int pageIndex) {

        return "/app/bc_app_rank.php?rankId=" + rankId + "&pageIndex=" + pageIndex + "&"
                + ConfigVersion.getVersion();
    }

    /** 分类 -最热 【读域名】 */
    public static String getSortDetailsHotUrl(String cid, int pageIndex) {

        return "/app/bc_app_rank.php?pageCount=20&rankId=102" + "&cid=" + cid + "&pageIndex="
                + pageIndex + "&" + ConfigVersion.getVersion();
    }

    /** 分类 -完结 【读域名】 */
    public static String getSortDetailsEndUrl(String cid, int pageIndex) {

        return "/app/bc_app_rank.php?pageCount=20&rankId=200" + "&cid=" + cid + "&pageIndex="
                + pageIndex + "&" + ConfigVersion.getVersion();
    }

    /** 分类 -最新【读域名】 */
    public static String getSortDetailsNewUrl(String cid, int pageIndex) {

        return "/app/bc_app_rank.php?pageCount=20&rankId=101" + "&cid=" + cid + "&pageIndex="
                + pageIndex + "&" + ConfigVersion.getVersion();
    }

    /**
     * 获取泡豆/充值记录 【充值域名】
     * 
     * @param isGetRecharge 是否获取充值记录(余额一直返回)
     * @return
     */
    public static String getPDHistory(boolean isGetRecharge, String pageindex) {// pay.shuqireader.com
        String url = "";
        if (isGetRecharge) {
            url =
                    "/appapi/pppay/pppay_ppdou_log.php?is_charge=1&pageCount=20&pageIndex="
                            + pageindex + "&getRecharge=" + isGetRecharge + "&"
                            + ConfigVersion.getVersion();
        } else {
            url =
                    "/appapi/pppay/pppay_ppdou_log.php?is_charge=1" + "&getRecharge="
                            + isGetRecharge + "&" + ConfigVersion.getVersion();
        }
        return url;
    }

    /** 推广墙开关 */
    public static String getOfferWallOpenUrl(Context context) {
        // String url = "/android/is_ofw_open.php?" + ConfigVersion.getVersion();
        String url =
                "http://"
                        + StaticDomains.getInstance().getStaticDomainKey(context,
                                StaticDomains.TYPE_ID_STATICDOMAIN_AD) + "/android/is_ofw_open_"
                        + ConfigVersion.getVersionByType(1) + ".xml";
        return url;
    }

    /**
     * 推广墙首页 api7.shuqireader.com
     */
    public static String getOfferWallUrl(Context context, String pageindex, String type) {
        // String url =
        // "/android/ofw.php?pagesize=20&pageindex=" + pageindex + "&ofw_type=" + type + "&"
        // + ConfigVersion.getVersion();
        String url =
                "http://"
                        + StaticDomains.getInstance().getStaticDomainKey(context,
                                StaticDomains.TYPE_ID_STATICDOMAIN_AD) + "/android/ofw_"
                        + ConfigVersion.getVersionByType(0) + "_" + type + "_20_" + pageindex
                        + ".xml";
        return url;
    }

    /** 推广墙详细页 */
    public static String getOfferWallItemUrl(Context context, String itemid, String from) {
        // String url =
        // "/android/ofwview.php?id=" + itemid + "&sd=" + from + "&"
        // + ConfigVersion.getVersion();
        String url =
                "http://"
                        + StaticDomains.getInstance().getStaticDomainKey(context,
                                StaticDomains.TYPE_ID_STATICDOMAIN_AD) + "/android/ofwview_"
                        + ConfigVersion.getVersionByType(0) + "_" + itemid + "_" + from + ".xml";
        return url;
    }

    /** 书签列表【读域名】 */
    public static String getLabelListUrl(String pageindex, String tagId) {
        String url =
                "/app/bc_app_tag.php?pageIndex=" + pageindex + "&tagId=" + tagId + "&"
                        + ConfigVersion.getVersion();
        return url;
    }

    // /**
    // * 我的收藏【读域名】
    // *
    // * @param userId 用户ID
    // * @param action getList取收藏列表 ；add添加收藏；remove删除收藏
    // * @return
    // */
    // public static String getMyFavoritUrl(String userId, ActionEnum actionEnum) {
    // String url =
    // "/app/bc_app_user_collect.php?user_id=" + userId + "&action=" + actionEnum.name()
    // + "&dataType=xml&" + ConfigVersion.getVersion();
    //
    // return url;
    // }

    /**
     * 我的收藏【写域名】
     * 
     * @param userId 用户ID
     * @param action getList取收藏列表 ；add添加收藏；remove删除收藏
     * @return
     */
    public static String getMyFavoritUrl(String userId, ActionEnum actionEnum) {

        String url = "/app/bc_app_user_collect.php?user_id=%s&action=%s&dataType=xml&%s";

        String finalUrl = String.format(url, userId, actionEnum.name(), ConfigVersion.getVersion());

        return finalUrl;
    }

    /**
     * 我的收藏【写域名】
     * 
     * @param userId 用户ID
     * @param action getList取收藏列表 ；add添加收藏；remove删除收藏
     * @return
     */
    public static String getMyFavoritUrl(String userId, String bookId, ActionEnum actionEnum) {

        String url = "/app/bc_app_user_collect.php?user_id=%s&action=%s&dataType=xml&&bookId=%s&%s";

        String finalUrl =
                String.format(url, userId, actionEnum.name(), bookId, ConfigVersion.getVersion());

        return finalUrl;
    }

    /** 作者作品列表 【读域名】 */
    public static String getAuthorListUrl(String pageindex, String authorId) {
        String url =
                "/app/bc_app_author.php?pageIndex=" + pageindex + "&authorId=" + authorId + "&"
                        + ConfigVersion.getVersion();
        return url;
    }

    /** 我的资料修改页 */
    public static String getMyAccountDataUrl() {
        String url = "/appapi/ppuser/ppuser_edit_info_server.php?" + ConfigVersion.getVersion();
        return url;
    }

    /** 密码修改【账户域名】 */
    public static String getPasswordModifyUrl() {
        String url = "/appapi/ppuser/ppuser_upd_pwd_server.php?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 书籍检查更新：书旗书籍【读域名】
     */
    public static String getCheckBooksUpdateShuQiUrl() {
        String url = "/app/bc_app_update_list.php?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 收费版云同步书签接口 【写域名】<br>
     * 
     * @param sendData 默认为yes下发数据，no为不下发数据
     * @return
     */
    public static String getSyncBookMarkUrl(String sendData) {
        String url =
                "/app/bc_app_book_mark.php?&sendData=" + sendData + "&"
                        + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 书籍检查更新：神马书籍【搜索域名】 <br>
     */
    public static String getCheckBooksUpdateShenMaUrl(String bookIds, String maxCids,
            String sourceIds) {
        String url =
                "/ppso_find_book_update.php?bookIds=" + bookIds + "&maxCids=" + maxCids
                        + "&sourceIds=" + sourceIds + "&" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 提交反馈 写接口 【写域名】
     * 
     * @param content 内容
     * @param contact 联系方式
     */
    public static String getFeedBackInsertURL(String action, String uid, int pageIndex) {// DEFAULT_IP1
        String url;
        url =
                "/app/bc_app_feedback.php?action=" + action + "&user_id=" + uid + "&pageIndex="
                        + pageIndex + "&" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 获取短信验证码
     * 
     * @return
     */
    public static String getValidationCodeUrl() {
        String url = "/appapi/ppuser/ppuser_app_vcode.php" + "?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 验证手机号码和短信验证码接口【账户域名】
     * 
     * @return
     */
    public static String getVerifyPhoneNumberUrl() {
        String url = "/appapi/ppuser/ppuser_app_vcode.php" + "?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 绑定接口【账户域名】
     * 
     * @return
     */
    public static String getAccountBindUrl() {
        String url = "/appapi/ppuser/ppuser_app_bind.php" + "?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 解绑微博接口
     * 
     * @return
     */
    public static String getThirdAccountUnbindUrl() {
        String url = "/appapi/ppuser/ppuser_three_jb_server.php?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 注册接口
     */
    public static String getAccountRegisterUrl() {
        String url = "/appapi/ppuser/ppuser_app_reg.php" + "?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 邮箱找回密码【账户域名】
     */
    public static String getFindPasswordByMailUrl() {
        String url =
                "/appapi/ppuser/ppuser_email_upd_pwd_server.php" + "?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 手机找回密码【账户域名】
     */
    public static String getFindPasswordByPhoneUrl() {
        String url =
                "/appapi/ppuser/ppuser_app_mobile_backpwd.php" + "?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 充值首页URL【充值域名】
     */
    public static String getPayUrl() {
        return "/appapi/pppay/pppay_ucpay_pay.php?" + ConfigVersion.getVersion();
    }

    /** 软件更新：获取软件版本 */
    public static String getAppUpdateUrl() {// api7.shuqireader.com
        String url = "/android/appinfo.php?req_type=update" + "&" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 获取用户资料接口 【账户域名】<br>
     * 包含验证用户身份（会员，准会员）
     * 
     * @return
     */
    public static String getGetAccountDetailUrl() {
        return "/appapi/ppuser/ppuser_app_imeisn2userid.php?" + ConfigVersion.getVersion();
    }

    /**
     * 在线获取用户身份 【账户域名】<br>
     * 
     * @return
     */
    public static String getGetAccountStateOnlineUrl() {
        return "/appapi/ppuser/ppuser_app_getuserid.php?" + ConfigVersion.getVersion();
    }


    /**
     * 登录【登录域名】
     * 
     * @return
     */
    public static String getLoginAccount() {
        String url = "/appapi/login_server/app_login_server.php" + "?" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 第三方登录接口【登录域名】
     * 
     * @return
     */
    public static String getLoginByThirdUrl() {
        String url =
                "/appapi/login_server/app_three_login_server.php?" + ConfigVersion.getVersion();
        return url;
    }

    /** 购买章节明细【读域名】 */
    public static String getPayChapterHistoryUrl(String user_id, int pageIndex, int pageCount,
            String bookId) {
        String url =
                "/app/bc_app_buy_record.php?user_id=" + user_id + "&pageIndex=" + pageIndex
                        + "&pageCount=" + pageCount + "&bookId=" + bookId + "&"
                        + ConfigVersion.getVersion();
        return url;
    }

    /** 购买历史【读域名】 */
    public static String getPurchaseHistoryUrl(String user_id, int pageIndex, int pageCount) {
        String url =
                "/app/bc_app_buy_record.php?user_id=" + user_id + "&pageIndex=" + pageIndex
                        + "&pageCount=" + pageCount + "&" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 打开软件访问的appInfo接口 【api7域名】
     * */
    public static String getGetSoftConfigInfoUrl() {
        return "/android/appinfo.php?" + ConfigVersion.getVersion();
    }

    /** 崩溃提交【写域名】 */
    public static String getBUGSubmit(String actname) {// DEFAULT_IP
        return "http://" + UrlManager.DOMAIN_WRITE + "/reader/crash_info_log.php?error_class="
                + actname + "&" + ConfigVersion.getVersion();
    }

    /** 公告栏 【读域名】 */
    public static String getNoticeUrl() {
        String url = "/appapi/notice/notice_list.php?dataType=%s&%s";

        String finalUrl = String.format(url, "xml", ConfigVersion.getVersion());

        return finalUrl;

    }

    /** 男频【读域名】 */
    public static String getManUrl() {
        String url = "/app/bc_app_column.php?columnType=2&" + ConfigVersion.getVersion();
        return url;
    }

    /** 女频【读域名】 */
    public static String getWomanUrl() {
        String url = "/app/bc_app_column.php?columnType=3&" + ConfigVersion.getVersion();
        return url;
    }

    /**
     * 广告地址：传入的参数不同返回的广告不同
     * 
     * @param context
     * @param bannerIndex 1 书旗首页下方通栏,2书旗封面页下方通栏,3书旗书包下方通栏 ,4搜索,5开屏
     * @return
     */
    public static String getAdvertisingURL(Context context, int bannerIndex) {
        String url = "";
        // url = "/android/ad.php?banner=" + bannerIndex + "&" + ConfigVersion.getVersion();
        url =
                "http://"
                        + StaticDomains.getInstance().getStaticDomainKey(context,
                                StaticDomains.TYPE_ID_STATICDOMAIN_AD) + "/android/ad_"
                        + ConfigVersion.getVersionByType(0) + "_" + bannerIndex + ".xml";
        Log4an.e("yjd", "url=" + url);
        return url;
    }

    /** 获取用户书龄接口[读域名]:Json */
    public static String getUserBookAgeUrl() {
        return "/app/bc_app_user_info.php?dataType=xml&" + ConfigVersion.getVersion();
    }

    /** 验证书籍下载地址的接口[读域名]:xml */
    public static String getVerifyBookDownLoadUrlUrl(String bookId) {
        return "/app/bc_app_bag_download.php?dataType=xml&bookId=" + bookId + "&"
                + ConfigVersion.getVersion();
    }

    /**
     * 获取推送内容的接口
     * 
     * @return
     */
    public static String getPushMessageUrl() {
        return "/appapi/push/push_message.php?dataType=xml&" + ConfigVersion.getVersion();
    }
}
